<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

include("/home/share/www/SourceSite-utf8/secure/language/lang_admin/thesame_1.lang.php");
@include("/home/share/www/union168.net/secure/common/Lotto.inc.php");
//$_data = ($_SERVER["REQUEST_METHOD"] == "GET")?$_GET:$_POST;
$arrWeb = explode(",", $_data["AllWeb"]);
$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 1;
$arrLotto = $_arrLotto[$intLID];
$arrBT = $_arrBet_Type[$arrLotto["LType"]];

$strTH = "";
$strTmp1 = "<tr><td class='web-name' title='{DB}'>{Web}</td>";
foreach($arrBT as $intBT => $strBT){
	if($intBT == 15)continue;
	$strTmp1 .= "<td class='web-td'><!--BT".$intBT."//-->0</td>";
	$strTH .= "<td width='40'>".$strBT."</td>";
}
$strTmp1 .= "</tr>\n";

$arrDB = array();
$strCon = "";
foreach($arrWeb as $strDN){
	$arrDN = explode("@", $strDN);
	$strDomain = $arrDN[0];
	$strDName = $arrDN[1];

	if($arrDN[2] == "")continue;
	include("/home/share/www/".$arrDN[2]."/secure/db.inc.php");
	if(!preg_match("/UTF8/i", $_blDBName))continue;

	$strTmp2 = $strTmp1;
	$strTmp2 = str_replace("{Web}", $strDName." <br /> ".$strDomain, $strTmp2);
	$strTmp2 = str_replace("{DB}", $_BetDBHost, $strTmp2);

	$strSQL = "select Bet_Type as BT, SUM(isStopBet) as OnNo from `bet_TodayGame".$intLID."` where LottoID = '".$intLID."' group by Bet_Type";
	$RS = @PMA_mysql_query($strSQL, $$_Conn);
	while($Rows = PMA_mysql_fetch_object($RS)){
		$strTmp = ($Rows -> OnNo == 0)?"On":"<a style='color: #FF0000;'>Off</a>";
		$strTmp2 = str_replace("<!--BT".$Rows -> BT."//-->0", $strTmp, $strTmp2);
	}
	$strCon .= $strTmp2;
	@mysql_free_result($RS);
	@mysql_close($$_Conn);
}
?><!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> Report </title>
<style>
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #EFFFDF;
}
td {
	font-size: 12px
	font-family: Arial, Helvetica, Verdana, Geneva,  sans-serif;
	background-color: #FFFFFF;
	text-align: center;
}
.showTable {
	background-color: #9DBAD8;
	border: 1px solid #056FD8;
}
.web-td {
	text-align: right;
	padding-right: 2px;
}
.web-name {
	text-align: left;
	padding-left: 2px;
}
//-->
</style>
</head>

<body>
<form action="" name="ReportFrm">
<select name="LottoID" onchange="document.ReportFrm.submit()">
<?php
foreach($_arrLotto as $intLottoID => $arrLotto){
	$strSd = ($intLID == $intLottoID)?" selected":"";
	print "<option value='".$intLottoID."'".$strSd.">".$arrLotto["Lotto_1"]."</option>\n";
}
?></select>
</form>
<table  border="0" cellspacing="1" cellpadding="0" class="showTable">
<tr>
	<td width="150">網站</td><?php print $strTH;?>
</tr>
<?php print $strCon;?>
</table>
</body>
</html>